<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <form id="reg">
        <input type="text" id="txt" value="1">
    </form>
</body>
<script>
    // 1. txt
    console.log(txt.value);

    // 2. form
    console.log(reg.firstElementChild.value);

    // 3. 通过数字索引获取表单元素
    console.log(reg[0].value);

    // 4. 
    console.log(document.forms[0].txt.value);

    // 5.
    console.log(document.forms[0][0].value);
</script>
</html>